package com.longjianghuasheng.logistics.business.order.viewmodel

import androidx.lifecycle.MutableLiveData
import com.longjianghuasheng.logistics.base.BaseMultiStateViewModel
import com.longjianghuasheng.logistics.data.model.bean.ApiResponseNoData
import com.longjianghuasheng.logistics.entity.OrderList
import com.longjianghuasheng.logistics.ext.commit2
import com.longjianghuasheng.logistics.network.apiService

class DriverOrderViewModel : BaseMultiStateViewModel() {
    var isLoaded = false

    var type = 0

    var id = 0

    val result by lazy {
        MutableLiveData<OrderList>()
    }

    val notify by lazy {
        MutableLiveData<ApiResponseNoData>()
    }

    fun driver_order_list() {

        getData2({ apiService.driver_order_list(page, type) }, result)
    }

    fun driver_order_cancel() {

        commit2({ apiService.driver_order_cancel(id) }, notify)

    }

    val deleteNotify by lazy {
        MutableLiveData<ApiResponseNoData>()
    }

    fun driver_order_del() {
        commit2({ apiService.driver_order_del(id) }, deleteNotify)
    }

    fun driver_order_done() {
        commit2({ apiService.driver_order_done(id) }, notify)
    }
}